//
//  ViewController.m
//  LBCityPickerView
//
//  Created by 杨庆人 on 17/8/24.
//  Copyright © 2017年 杨庆人. All rights reserved.
//

#import "ViewController.h"
#import "LBCityPickerView.h"
#import "Masonry.h"

@interface ViewController ()
@property (nonatomic,strong)UIButton * button;
@end

@implementation ViewController
- (UIButton *)button {
    if (!_button) {
        _button = [UIButton buttonWithType:UIButtonTypeCustom];
        _button.backgroundColor = [UIColor blackColor];
        [_button setTitle:@"选城市" forState:UIControlStateNormal];
        [_button addTarget:self action:@selector(buttonAtion) forControlEvents:UIControlEventTouchUpInside];
    }
    return _button;
}

- (void)buttonAtion {
    __weak typeof(self)weakSelf = self;
    [LBCityPickerView showCityPickViewByAnimation:YES LBCityPickerViewType:LBCityPickerViewTypeProvincialCityAreas Complete:^(LBCityMsgModel *selectedProvinceModel, LBCityMsgModel *selectedCityModel, LBCityMsgModel *selectedAreaModel) {
        
        [weakSelf.button setTitle:[NSString stringWithFormat:@"%@-%@-%@",selectedProvinceModel.areaName,selectedCityModel.areaName,selectedAreaModel.areaName] forState:UIControlStateNormal];
    }];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.view addSubview:self.button];

    [self.button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.mas_equalTo(self.view);
    }];
    // Do any additional setup after loading the view, typically from a nib.
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
